<?php
defined( 'BASEPATH' ) or exit( 'No direct script access allowed' );
class Log_handle extends MY_Controller
{
    private function get_lsit($general)
    {
        $begin = ( int ) $this->input->get( 'begin' );
        $length = ( int ) $this->input->get( 'length' );
        
        $begin = $begin < 0 ? 0 : $begin;
        $length = $length < 1 ? 10 : $length;
        
        $this->load->model( 'log_model' );
        $count = $this->log_model->get_list_count( $general );
        if ($begin > 0 && $begin >= $count)
        {
            $this->rs->err( 4 );
        }
        $list = $this->log_model->get_list( $length, $begin, $general );
        $this->rs->ok( array (
                'record_count' => $count,
                'list' => $list
        ) );
    }
    function operate_list()
    {
        $this->get_lsit( true );
    }
    function operate_list_super()
    {
        $this->get_lsit( false );
    }
}